package com.example.spring_3.ch03.service.impl;
import com.example.spring_3.ch03.pojo.SysUser;
import com.example.spring_3.ch03.service.UserService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class UserServiceImpl implements UserService {
    @Override
    public Page<SysUser> findpageByMap(Map param, Pageable pageable) {
        return null;
    }

//    @Resource
//    private UserRepository userRepository;
//
//    @Override
//    public Page<SysUser> findpageByMap(Map param, Pageable pageable) {
//        return userRepository.findPageByMap(new Specification<SysUser>(){
//            @Override
//            public Predicate toPredicate(Root<SysUser> root , CriteriaQuery<?> query , CriteriaBuilder cb){
//                List<Predicate>toPredicate = new ArrayList<>();
//
//                if (param.get("usrName") != null){
//                    predicates.add(cb.like(root.get("userName") , "%" + param.get("usrName")+"%"));
//                }
//                if (param.get("usrId") != null){
//                    predicates.add(cb.like(root.get("usrRoleId") , param.get("roleId")));
//                }
//                return cb.and(predicates.toArray(new Predicate[prediates.size()]))
//            }
//        }).pageable();
//    }
}
